package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zse {
   static void a(com.aspose.cells.b.a.d.zm var0, zvh var1, zby var2) throws Exception {
      byte[] var3 = new byte[8];
      var0.a(var3, 0, 8);
      var3 = var2.c(var3, 0L);
      int var4 = com.aspose.cells.b.a.zc.a(var3, 0);
      int var5 = com.aspose.cells.b.a.zc.a(var3, 4);
      var3 = new byte[var5];
      var0.a((long)var4, 0);
      var0.a(var3, 0, var3.length);
      var3 = var2.c(var3, 0L);
      zsf[] var7 = null;
      byte var6 = 0;
      int var8 = com.aspose.cells.b.a.zc.a(var3, var6);
      int var13 = var6 + 4;
      var7 = new zsf[var8];

      for(int var9 = 0; var9 < var8; ++var9) {
         zsf var10 = new zsf();
         var10.a = com.aspose.cells.b.a.zc.a(var3, var13);
         var10.b = com.aspose.cells.b.a.zc.a(var3, var13 + 4);
         var13 += 8;
         var10.c = com.aspose.cells.b.a.zc.b(var3, var13);
         var13 += 2;
         int var11 = var3[var13] & 255;
         ++var13;
         var10.d = (var3[var13] & 255 & 1) != 0;
         ++var13;
         var13 += 4;
         var10.e = Encoding.getUnicode().a(var3, var13, var11 * 2);
         var13 += var11 * 2 + 2;
         var7[var9] = var10;
      }

      if (var7 != null) {
         for(var8 = 0; var8 < var7.length; ++var8) {
            zsf var14 = var7[var8];
            var0.a((long)var14.a, 0);
            var3 = new byte[var14.b];
            var0.a(var3, 0, var3.length);
            var3 = var2.c(var3, (long)var14.c);
            if (var14.d) {
               var1.a().a(var14.e, new com.aspose.cells.b.a.d.zh(var3));
            } else {
               zvh var15 = null;

               try {
                  var15 = new zvh(new com.aspose.cells.b.a.d.zh(var3));
               } catch (Exception var12) {
                  ;
               }

               if (var15 != null) {
                  var1.a().a(var14.e, var15.a());
               } else {
                  var1.a().a(var14.e, new com.aspose.cells.b.a.d.zh(var3));
               }
            }
         }
      }

   }

   static void a(zvh var0, zby var1) throws Exception {
      com.aspose.cells.b.a.d.zh var2 = new com.aspose.cells.b.a.d.zh();
      byte[] var3 = new byte[8];
      var2.b(var3, 0, 8);
      ArrayList var4 = new ArrayList();
      Iterator var5 = var0.a().c().iterator();

      while(true) {
         while(var5.hasNext()) {
            String var6 = (String)var5.next();
            if ("XML".equals(var6)) {
               a(var2, var0, var6, var4, var1);
            } else if (var6.length() == 11 && (var6.startsWith("MBD") || var6.startsWith("LNK"))) {
               a(var2, var0, var6, var4, var1);
            }
         }

         if (var4.size() == 0) {
            return;
         }

         a(var2, var0, "\u0005SummaryInformation", var4, var1);
         int var9 = (int)var2.i();
         com.aspose.cells.b.a.d.zh var10 = new com.aspose.cells.b.a.d.zh();
         var10.b(com.aspose.cells.b.a.zc.a(var4.size()), 0, 4);
         Iterator var7 = var4.iterator();

         while(var7.hasNext()) {
            zsf var8 = (zsf)var7.next();
            var0.a().g(var8.e);
            var10.b(com.aspose.cells.b.a.zc.a(var8.a), 0, 4);
            var10.b(com.aspose.cells.b.a.zc.a(var8.b), 0, 4);
            var10.b(com.aspose.cells.b.a.zc.a(var8.c), 0, 2);
            var10.a((byte)var8.e.length());
            var10.a((byte)(var8.d ? 1 : 0));
            var10.b(var3, 0, 4);
            var10.b(Encoding.getUnicode().a(var8.e), 0, var8.e.length() * 2);
            var10.b(var3, 0, 2);
         }

         int var11 = (int)var10.h();
         byte[] var12 = var10.o();
         var12 = var1.c(var12, 0L);
         var2.b(var12, 0, var12.length);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var9), 0, var3, 0, 4);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var11), 0, var3, 4, 4);
         var3 = var1.c(var3, 0L);
         var2.a(0L, 0);
         var2.b(var3, 0, 8);
         var2.a(0L, 0);
         var0.a().a("encryption", var2);
         return;
      }
   }

   private static void a(com.aspose.cells.b.a.d.zh var0, zvh var1, String var2, ArrayList var3, zby var4) throws Exception {
      zsf var5 = new zsf();
      com.aspose.cells.b.a.a.ze.a(var3, (Object)var5);
      var5.e = var2;
      var5.c = var3.size();
      var5.a = (int)var0.i();
      Object var6 = var1.a().d(var2);
      com.aspose.cells.b.a.d.zh var7 = null;
      if (var6 instanceof zane) {
         var7 = new com.aspose.cells.b.a.d.zh();
         zvh var8 = new zvh((zane)var6);
         var8.a((com.aspose.cells.b.a.d.zm)var7);
         var7.a(0L, 0);
         var5.d = false;
      } else {
         var7 = (com.aspose.cells.b.a.d.zh)var6;
         var5.d = true;
      }

      byte[] var9 = com.aspose.cells.a.c.zw.a(var7, false);
      var9 = var4.c(var9, (long)var5.c);
      var5.b = var9.length;
      var0.b(var9, 0, var9.length);
   }
}
